package com.ruoyi.project.cms.knowledgemanagement.controller;

import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.cms.knowledgemanagement.domain.Knowledge;
import com.ruoyi.project.cms.knowledgemanagement.domain.KnowledgeHard;
import com.ruoyi.project.cms.knowledgemanagement.service.IKnowledgeBenchmarkingService;
import com.ruoyi.project.cms.knowledgemanagement.service.IKnowledgeHardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Controller
@RequestMapping("/knowledgemanagement/knowledgeHard")
public class KnowledgeHardController extends BaseController {

    @Autowired
    private IKnowledgeHardService iKnowledgeHardService;

    @Autowired
    private IKnowledgeBenchmarkingService iKnowledgeBenchmarkingService;


    String prefix = "/cms/knowledgemanagement";

    @GetMapping("")
    public String knowledge(){

        return prefix+"/hard";
    }

    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo selectOne(KnowledgeHard knowledgeHard){
        startPage();
        List<KnowledgeHard> list = iKnowledgeHardService.selectOne(knowledgeHard);
        return getDataTable(list);
    }

    @GetMapping("/edit")
    public String edit(){

        return prefix+"/edit";
    }

    /**
     * 查看
     */
    @GetMapping("/detail/{project_id}")
    public String edit(@PathVariable("project_id") Long project_id, ModelMap mmap)
    {
        mmap.put("KnowledgeBenchmarking", iKnowledgeBenchmarkingService.selectKnowledgeBenchmarkingById(project_id));
        return prefix + "/detail";
    }

}
